package superbubble.entry;

import java.util.ArrayList;
import java.util.List;

public class StrongConnectedComponent {
	private int componentId;
	private List<Integer> nodes;
	public StrongConnectedComponent() {
		super();
		this.nodes = new ArrayList<Integer>();
	}
	public void addNodeToComponent(int node){
		nodes.add(node);
	}
	public int getComponentId() {
		return componentId;
	}
	public void setComponentId(int componentId) {
		this.componentId = componentId;
	}
	public List<Integer> getNodes() {
		return nodes;
	}
	public void setNodes(List<Integer> nodes) {
		this.nodes = nodes;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + componentId;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		StrongConnectedComponent other = (StrongConnectedComponent) obj;
		if (componentId != other.componentId)
			return false;
		return true;
	}
	
	@Override
	public String toString() {
		String res = new String();
		res = "SSC # "+ componentId +";  nodes: ";
		for(int i=0; i<nodes.size();i++){
			res+=" " + nodes.get(i)+";";
		}
		return res;
	}
}
